#include <header.h>

int main(){

    //char *path = "/home/snow/3th/04_Linux/CODE/Day15/dir1";
    char *path = "./dir1";
    DIR * dir = opendir(path);
    ERROR_CHECK(dir, NULL, "opendir");


    struct dirent * dt = readdir(dir);
    while(dt != NULL){
        // dt代表读取的每一个子文件/目录信息

        if(dt->d_type == DT_DIR && dt->d_name[0] != '.'){
            printf("目录:  %s \n", dt->d_name);

            char buf[700]={0};
            sprintf(buf, "%s/%s", path, dt->d_name);
            printf("path: %s \n", buf);
            DIR * dir2 = opendir(buf);
            ERROR_CHECK(dir2, NULL, "dir2");
            
            
        }else{
            printf("%s\n", dt->d_name);
        }


        dt = readdir(dir);
    }


    closedir(dir);
    return 0;
}

